<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        Array.prototype.my_fliter = function(fn){
            if(typeof fn !== 'function'){
                throw Error("参数应该是一个函数")
            }
            let res = []
            for(let i=0;i<this.length;i++)
            {
                if(fn(this[i])){
                    res.push(this[i])
                }
            }
            return res
        }
    </script>
</body>
</html>